/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package thienphuc.patient.util;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import thienphuc.patient.screen.department.SearchDepartment;

/**
 *
 * @author QUOCDAT
 */
public class JButtonTableExample extends JFrame {

    public JButtonTableExample() {
        super("JButtonTable Example");

        DefaultTableModel dm = new DefaultTableModel();
        dm.setDataVector(new Object[][]{{"button 1", "foo"},
                    {"button 2", "bar"}}, new Object[]{"Button", "String"});

        JTable table = new JTable(dm);
        table.getColumn("Button").setCellRenderer(new JTableButtonRenderer());
//        table.getColumn("Button").setCellEditor(
//                new JTableButtonEditor(new JCheckBox()));
        JScrollPane scroll = new JScrollPane(table);
        getContentPane().add(scroll);
        setSize(400, 100);
        setVisible(true);
    }

    public static void main(String[] args) {

        SearchDepartment searchDepartment = new SearchDepartment();
        searchDepartment.setVisible(true);

//        JButtonTableExample frame = new JButtonTableExample();
//        frame.addWindowListener(new WindowAdapter() {
//
//            public void windowClosing(WindowEvent e) {
//                System.exit(0);
//            }
//        });
    }
}